import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
import pandas as pd
# 需要提前安装
# pip install pandas
# pip install openpyxl
mpl.rcParams['font.sans-serif']=['SimHei']#让中文可以正常显示
plt.rcParams['axes.unicode_minus']=False #让负号能够正常显示
data6=pd.read_excel('可视化图表.xlsx',sheet_name=6)
print(data6.head())
plt.figure()
plt.subplot(2,1,1)
plt.hist(data6['temp'],edgecolor='k')
plt.subplot(2,1,2)
plt.hist(data6['temp'],edgecolor='k',density=True)
plt.show()
